import Vue from 'vue';
import Vuex from 'vuex';
Vue.use(Vuex);



const state={   //要设置的全局访问的state对象
  open_id:'',
  userInfo:{},
  //要设置的初始属性值
};


const getters = {   //实时监听state值的变化(最新状态)
  userInfo(state) {  //方法名随意,主要是来承载变化的userInfo的值
    return state.userInfo
  }
};
const mutations = {
  setOpenId:function (state,data) {
    state.open_id = data;
  },
  setUserInfo:function (state,data) {
    state.userInfo = data;
  },
};

const store = new Vuex.Store({
  state,
  getters,
  mutations,
});
export default store;
